import 'package:FiduMart/generated/json/base/json_convert_content.dart';
import 'package:FiduMart/core/network/model/cdn_activity_entity.dart';

CdnActivityEntity $CdnActivityEntityFromJson(Map<String, dynamic> json) {
  final CdnActivityEntity cdnActivityEntity = CdnActivityEntity();
  final int? id = jsonConvert.convert<int>(json['id']);
  if (id != null) {
    cdnActivityEntity.id = id;
  }
  final int? type = jsonConvert.convert<int>(json['type']);
  if (type != null) {
    cdnActivityEntity.type = type;
  }
  final String? nameZh = jsonConvert.convert<String>(json['nameZh']);
  if (nameZh != null) {
    cdnActivityEntity.nameZh = nameZh;
  }
  final String? nameEn = jsonConvert.convert<String>(json['nameEn']);
  if (nameEn != null) {
    cdnActivityEntity.nameEn = nameEn;
  }
  final String? nameTha = jsonConvert.convert<String>(json['nameTha']);
  if (nameTha != null) {
    cdnActivityEntity.nameTha = nameTha;
  }
  final String? pictureZh = jsonConvert.convert<String>(json['pictureZh']);
  if (pictureZh != null) {
    cdnActivityEntity.pictureZh = pictureZh;
  }
  final String? pictureEn = jsonConvert.convert<String>(json['pictureEn']);
  if (pictureEn != null) {
    cdnActivityEntity.pictureEn = pictureEn;
  }
  final String? pictureTha = jsonConvert.convert<String>(json['pictureTha']);
  if (pictureTha != null) {
    cdnActivityEntity.pictureTha = pictureTha;
  }
  final int? strattime = jsonConvert.convert<int>(json['strattime']);
  if (strattime != null) {
    cdnActivityEntity.strattime = strattime;
  }
  final int? endtime = jsonConvert.convert<int>(json['endtime']);
  if (endtime != null) {
    cdnActivityEntity.endtime = endtime;
  }
  final int? creationtime = jsonConvert.convert<int>(json['creationtime']);
  if (creationtime != null) {
    cdnActivityEntity.creationtime = creationtime;
  }
  final int? state = jsonConvert.convert<int>(json['state']);
  if (state != null) {
    cdnActivityEntity.state = state;
  }
  final int? top = jsonConvert.convert<int>(json['top']);
  if (top != null) {
    cdnActivityEntity.top = top;
  }
  final int? sorting = jsonConvert.convert<int>(json['Sorting']);
  if (sorting != null) {
    cdnActivityEntity.sorting = sorting;
  }
  final int? eventDetails = jsonConvert.convert<int>(json['EventDetails']);
  if (eventDetails != null) {
    cdnActivityEntity.eventDetails = eventDetails;
  }
  return cdnActivityEntity;
}

Map<String, dynamic> $CdnActivityEntityToJson(CdnActivityEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['id'] = entity.id;
  data['type'] = entity.type;
  data['nameZh'] = entity.nameZh;
  data['nameEn'] = entity.nameEn;
  data['nameTha'] = entity.nameTha;
  data['pictureZh'] = entity.pictureZh;
  data['pictureEn'] = entity.pictureEn;
  data['pictureTha'] = entity.pictureTha;
  data['strattime'] = entity.strattime;
  data['endtime'] = entity.endtime;
  data['creationtime'] = entity.creationtime;
  data['state'] = entity.state;
  data['top'] = entity.top;
  data['Sorting'] = entity.sorting;
  data['EventDetails'] = entity.eventDetails;
  return data;
}

extension CdnActivityEntityExt on CdnActivityEntity {
  CdnActivityEntity copyWith({
    int? id,
    int? type,
    String? nameZh,
    String? nameEn,
    String? nameTha,
    String? pictureZh,
    String? pictureEn,
    String? pictureTha,
    int? strattime,
    int? endtime,
    int? creationtime,
    int? state,
    int? top,
    int? sorting,
    int? eventDetails,
  }) {
    return CdnActivityEntity()
      ..id = id ?? this.id
      ..type = type ?? this.type
      ..nameZh = nameZh ?? this.nameZh
      ..nameEn = nameEn ?? this.nameEn
      ..nameTha = nameTha ?? this.nameTha
      ..pictureZh = pictureZh ?? this.pictureZh
      ..pictureEn = pictureEn ?? this.pictureEn
      ..pictureTha = pictureTha ?? this.pictureTha
      ..strattime = strattime ?? this.strattime
      ..endtime = endtime ?? this.endtime
      ..creationtime = creationtime ?? this.creationtime
      ..state = state ?? this.state
      ..top = top ?? this.top
      ..sorting = sorting ?? this.sorting
      ..eventDetails = eventDetails ?? this.eventDetails;
  }
}